home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Book Chapters / 03 - Advanced Graphics / Example 4 - Encoder / main.c < prev    next >
C/C++ Source or Header  |  1995-02-25  |  1KB  |  86 lines

  1. //
  2. //    File: main.c
  3. //
  4. //    This file contains the code for a simple shape encoder.
  5. //    It will encode all the picts in the resource fork as shapes and exit.
  6. //
  7. //    2/25/95 -- Created by Mick
  8. //
  9.  
  10. // include files
  11.  
  12. #include "global.h"
  13.  
  14. #include "main.h"
  15.  
  16. #include "encoder.h"
  17.  
  18. // defines for this file
  19.  
  20. // global function declarations
  21.  
  22. void main( void );
  23.  
  24. // global data owned by this file
  25.  
  26. CTabHandle gAppColorTable;            // the color table that we are drawing with
  27.  
  28. // local function declarations
  29.  
  30. static void initMacToolboxes( void );
  31.  
  32. // static data
  33.  
  34. // functions
  35.  
  36. //
  37. // main -
  38. //        This is where it all begins.
  39. //
  40.  
  41. void main( void )
  42. {
  43.     // fire up the toolboxes
  44.     initMacToolboxes();
  45.     
  46.     // get the color table
  47.     gAppColorTable = GetCTable( kAppColorTableResID );
  48.     
  49.     // give the encoding code a chance to setup
  50.     startupEncoder();
  51.     
  52.     // handle events until the user signals a quit
  53.     doEncode();
  54.     
  55.     // give the encoding a chance to shutdown
  56.     shutdownEncoder();
  57. }
  58.  
  59. //
  60. // initMacToolboxes -
  61. //        Initialize all the toolboxes that we will need.
  62. //
  63.  
  64. void initMacToolboxes( void )
  65. {
  66.     // initialize all the toolboxes
  67.     InitGraf( &( qd.thePort ) );
  68.     InitFonts();
  69.     InitWindows();
  70.     InitMenus();
  71.     TEInit();
  72.     InitDialogs( ( ProcPtr )kNil );
  73.     InitCursor();
  74.     
  75.     // make sure that we have the enitre heap
  76.     MaxApplZone();
  77.     
  78.     // allocate some extra master pointers
  79.     MoreMasters();
  80.     MoreMasters();
  81.     MoreMasters();
  82.     MoreMasters();
  83.     
  84.     // set the random seed
  85.     qd.randSeed = TickCount();
  86. }